{literal}
  <script type="text/javascript">
<!--
function confirmschemeDelete(articleId) {
if (confirm("This will delete this award scheme. Continue?"))
document.location = "admin.php?page=advancements&action=delsch&id=" + articleId;
}
function confirmDelete(articleId, sid) {
if (confirm("This will delete this award badge. Continue?"))
document.location = "admin.php?page=advancements&action=deladd&id=" + articleId + "&sid=" + sid;
}
function confirmDelete2(articleId, ids, sid) {
if (confirm("This will delete this requirement. Continue?"))
document.location = "admin.php?page=advancements&action=delreq&rid=" + articleId + "&id=" + ids + "&sid=" + sid;
}
//-->
  </script>
  {/literal}
{if ($action != "viewadd") && ($action != "editadd") && ($action != "newadd") && ($action != "editreq") && ($action != "newreq") && ($action != "newsch") && ($action != "editsch") && ($action != "viewsch")}
{if $numschemes > 0}
<h2>Award Schemes</h2>
<div align="left"><input type="button" class="button" value="Add Award Scheme" onclick="window.location='{$pagename}&amp;action=newsch'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
  <tr valign="top"> 
    <th width="10%" class="smallhead">Action</th>
    <th width="53%" class="smallhead">Award Scheme</th>
    <th width="25%" class="smallhead">Number of badges</th>
  </tr>
 {section name=schemeloop loop=$numschemes}
	  <tr valign="middle"> 
		<td width="10%" class="text"><a href="{$pagename}&amp;action=viewsch&amp;id={$schemes[schemeloop].id}"><img src="{$tempdir}admin/images/mod.gif" border="0" alt="View {$schemes[schemeloop].name} items" title="View {$schemes[schemeloop].name} items" /></a> - <a href="{$pagename}&amp;id={$schemes[schemeloop].id}&amp;action=editsch"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$schemes[schemeloop].name}" title="Edit {$schemes[schemeloop].name}" /></a> - <a href="javascript:confirmschemeDelete({$schemes[schemeloop].id})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$schemes[schemeloop].name}" title="Delete {$schemes[schemeloop].name}" /></a></td>
		<td width="53%" class="text">{$schemes[schemeloop].name}</td>
		<td width="25%" class="text">{$schemes[schemeloop].numitems}</td>
	  </tr>  
	{/section}
</table>
{else}
<div align="center">No Award Schemes</div>
{/if}
<div align="left"><input type="button" class="button" value="Add Award Scheme" onclick="window.location='{$pagename}&amp;action=newsch'" /></div>
{elseif $action == "newsch" || $action == "editsch"}
<form name="News" method="post" action="{$editFormAction}{if $action=="editsch"}&amp;action=editsch&amp;id={$id}{else}&amp;action=newsch{/if}">
    {if $action=="editsch"}<h2>Edit Award Scheme</h2>{else}<h2>Add a Award Scheme</h2>{/if}
    <p align="center">Name of award scheme: <input name="adv" type="text" id="adv" size="40" maxlength="30" value="{$advan}" class="inputbox" />
</p>
    <p align="center">
      <input type="submit" name="Submit" value="Submit" class="button" />
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
        </p>
</form>
{elseif $action == "viewsch"}
{if $numads > 0}
<h2>Badges in {$scheme} Award Scheme</h2>
<div align="left"><input type="button" class="button" value="Add Award Badge" onclick="window.location='{$pagename}&amp;action=newadd&amp;sid={$sid}'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
  <tr valign="top"> 
    <th width="10%" class="smallhead">Action</th>
    <th width="53%" class="smallhead">Award Badge</th>
    <th width="25%" class="smallhead">Number of requirements </th>
    <th class="smallhead">Position</th>
  </tr>
 {section name=adloop loop=$numads}
	  <tr valign="middle"> 
		<td width="10%" class="text"><a href="{$pagename}&amp;action=viewadd&amp;id={$adv[adloop].ID}&amp;sid={$sid}"><img src="{$tempdir}admin/images/mod.gif" border="0" alt="View {$adv[adloop].advancement} items" title="View {$adv[adloop].advancement} items" /></a> - <a href="{$pagename}&amp;id={$adv[adloop].ID}&amp;action=editadd&amp;sid={$sid}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$adv[adloop].advancement}" title="Edit {$adv[adloop].advancement}" /></a> - <a href="javascript:confirmDelete({$adv[adloop].ID},{$sid})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$adv[adloop].advancement}" title="Delete {$adv[adloop].advancement}" /></a></td>
		<td width="53%" class="text">{$adv[adloop].advancement}</td>
		<td width="25%" class="text">{$adv[adloop].numitems}</td>
    <td class="text">{if $smarty.section.adloop.iteration != 1}<a href="{$pagename}&amp;action=moveup&amp;id={$adv[adloop].ID}"><img src="{$tempdir}admin/images/up.gif" border="0" alt="Up" title="Move Up" /></a>&nbsp;{/if}{if $smarty.section.adloop.iteration != $numads}<a href="{$pagename}&amp;action=movedown&amp;id={$adv[adloop].ID}"><img src="{$tempdir}admin/images/down.gif" border="0" alt="Up" title="Move Down" /></a>{/if}</td>
	  </tr>  
	{/section}
</table>
{else}
<div align="center">No Badges in {$scheme} Award Scheme</div>
{/if}
<div align="left"><input type="button" class="button" value="Add Award Badge" onclick="window.location='{$pagename}&amp;action=newadd&amp;sid={$sid}'" /> <input type="button" class="button" value="Back to Previous" onclick="window.location='{$pagename}'" /></div>
{elseif $action == "newadd" || $action=="editadd"}
<form name="News" method="post" action="{$editFormAction}{if $action=="editadd"}&amp;action=editadd&amp;sid={$sid}&amp;id={$id}{else}&amp;action=newadd&amp;sid={$sid}{/if}">
    <h2>Add a Award Badge</h2>
    <p align="center">Name of award badge: <input name="adv" type="text" id="adv" size="40" maxlength="30" value="{$advan}" class="inputbox" />
</p>
    <p align="center">
      <input type="submit" name="Submit" value="Submit" class="button" />
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
    </p>
</form>
{elseif $action=="viewadd"}
{if $numreqs > 0}
<h2>Requirements for {$advan}</h2>
<div align="left"><input type="button" class="button" value="Add a Requirement" onclick="window.location='{$pagename}&amp;action=newreq&amp;id={$id}&amp;sid={$sid}'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
  <tr valign="top">
    <th width="8%" class="smallhead">Action</th>
    <th width="67%" class="smallhead">Requirement</th>
    <th width="14%" class="smallhead">Position</th>
  </tr>
  {section name=adloop loop=$numreqs}
  <tr valign="middle">
    <td width="8%" class="text">
      <div align="center" class="text"><a href="{$pagename}&amp;rid={$req[adloop].ID}&amp;action=editreq&amp;id={$id}&amp;sid={$sid}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$req[adloop].item}" title="Edit {$req[adloop].item}" /></a> - <a href="javascript:confirmDelete2({$req[adloop].ID},{$id},{$sid})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$req[adloop].item}" title="Delete {$req[adloop].item}" /></a></div></td>
    <td width="67%" class="text">{$req[adloop].item}</td>
    <td class="text">{if $smarty.section.adloop.iteration != 1}<a href="{$pagename}&amp;action=moveitemup&amp;id={$id}&amp;rid={$req[adloop].ID}&amp;sid={$sid}"><img src="{$tempdir}admin/images/up.gif" border="0" alt="Up" title="Move Up" /></a>&nbsp;{/if}{if $smarty.section.adloop.iteration != $numreqs}<a href="{$pagename}&amp;action=moveitemdown&amp;id={$id}&amp;rid={$req[adloop].ID}&amp;sid={$sid}"><img src="{$tempdir}admin/images/down.gif" border="0" alt="Up" title="Move Down" /></a>{/if}</td>
  </tr>
  {/section}
</table>
{else}
<div align="center">No requirements for {$advan}</div>
{/if}
<div align="left"><input type="button" class="button" value="Add a Requirement" onclick="window.location='{$pagename}&amp;action=newreq&amp;id={$id}&amp;sid={$sid}'" />
<input type="button" class="button" value="Back to Previous" onclick="window.location='{$pagename}&amp;action=viewsch&amp;id={$sid}'" /></div>
{elseif $action == "newreq" || $action=="editreq"}
<form name="News" method="post" action="{$editFormAction}{if $action=="editreq"}&amp;action=editreq&amp;id={$id}&amp;rid={$requirement.ID}&amp;sid={$sid}{else}&amp;action=newreq&amp;id={$id}&amp;sid={$sid}{/if}">
  <h2>Requirement for {$advan}</h2>
  <p align="center">Requirement:
    <input name="req" type="text" {if $requirement.item != ""}value="{$requirement.item}"{/if} size="100" class="inputbox" />
   </p>
  <p align="center">Description:<br />
    <textarea name="desc" cols="100" rows="10">{$requirement.description}</textarea>
</p>
  <p align="center">
    <input type="submit" name="Submit" value="Submit" class="button" />
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button"/>
   </p>
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-award" target="_blank">Help</a>
</div>
